package com.example.lijinyuan.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private List<ListBean> listBeen;
    private ListView listView;
    private ListAdapter listAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listBeen = new ArrayList<>();
        listBeen = initData();
        listView = (ListView) findViewById(R.id.mylistview);
        listAdapter = new ListAdapter(this, listBeen);
        listView.setAdapter(listAdapter);

    }

    private List<ListBean> initData() {
        for (int i = 0; i < 100; i++) {
            listBeen.add(new ListBean("title" + i, R.mipmap.ic_launcher));
        }
        return listBeen;
    }
}
